/**
 * goal
 *
 * outlook@China software studio
 * Copyright (c) 2008-2010. All Rights Reserved.
 * http://www.outlook.com
 */

package org.outlook.apps.goal.ui.components;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

/**
 * function:
 * @author Watson email: watson.wu@hotmail.com
 * @date 2010
 */
public class GoalListPopupMenu extends JPopupMenu {

	private static final long serialVersionUID = 1L;
	
//	private JMenuItem[] items = new JMenuItem[4];

	private JMenuItem updateItem;

	public GoalListPopupMenu(String string) {
		super(string);
	}

	public void attachMenuItem() {
		JMenuItem item = new JMenuItem("Add Event");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Menu item Add Event");
			}
		});
		this.add(item);

		updateItem = new JMenuItem("Update");
		updateItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Menu item Update");
			}
		});
		updateItem.setVisible(false);
		this.add(updateItem);

		item = new JMenuItem("Block");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Menu item Block");
			}
		});
		this.add(item);

		item = new JMenuItem("Delete");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Menu item Clear");
			}
		});
		this.add(item);

		item = new JMenuItem("View All");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Menu item View All");
			}
		});
		this.add(item);
	}

	public void showEntryMenu(Component component, int x, int y) {
		updateItem.setVisible(true);
		show(component, x, y);
	}

}
